﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hydra.Shell.Attributes;
using Hydra.UrlMon.Implementation;
using Hydra.UrlMon.Enumerations;

namespace Hydra.UrlMon.Interfaces
{
    public interface IInternetProtocolSink
    {
        /// <summary>Passes data from an asynchronous pluggable protocol's worker thread intended for the same asynchronous pluggable protocol's apartment thread.</summary>
        /// <remarks>The IInternetProtocolSink interface should pass the data from the worker thread, without modification, back to the asynchronous pluggable protocol by calling its IInternetProtocolRoot::Continue method.
        /// Asynchronous pluggable protocol handlers can operate asynchronously in a separate worker thread. This method allows the protocol handler to pass data back to the apartment (or user interface) thread it was created on.</remarks>
        /// <param name="pProtocolData">
        /// PROTOCOLDATA structure containing the data to be passed back to the apartment thread.</param>
        void Switch(ref ProtocolData pProtocolData);

        /// <summary>Reports progress made during a state operation. </summary>
        /// <remarks>Asynchronous pluggable protocol handlers should not generate the BINDSTATUS, BINDSTATUS, and BINDSTATUS reports, since they are generated internally when the data arrives.</remarks>
        /// <param name="ulStatusCode">
        /// BINDSTATUS value that indicates the status of the state operation.</param>
        /// <param name="szStatusText">
        /// String value that describes the status of the state operation.</param>
        void ReportProgress(BindStatus ulStatusCode, string szStatusText);

        /// <summary>Reports the amount of data that is available on the thread. </summary>
        /// <param name="grfBSCF">
        /// BSCF value that indicates the type of data available. BSCF indicates that all available data has been reported.</param>
        /// <param name="ulProgress">
        /// Integer value that indicates the progress made so far.</param>
        /// <param name="ulProgressMax">
        /// Integer value that indicates the total amount of work to be done.</param>
        void ReportData(BindStatusCallbackFlags grfBSCF, int ulProgress, int ulProgressMax);

        /// <summary>Reports the result of the operation when called on any thread. </summary>
        /// <remarks>Notes to implementers
        /// After your IInternetProtocolSink::ReportResult method is called, your application should call the protocol handler's IInternetProtocol::LockRequest method to lock the resource you are reading from the protocol handler. Then your application should call the protocol handler's IInternetProtocolRoot::Terminate method. 
        /// Notes to callers
        /// The call to IInternetProtocolSink::ReportResult is the last call that your pluggable protocol handler must make to the client application's IInternetProtocolSink interface.</remarks>
        /// <param name="hrResult">
        /// HRESULT value that indicates the result returned by the operation.</param>
        /// <param name="dwError">
        /// Integer value that is a protocol-specific code.</param>
        /// <param name="szResult">
        /// Protocol-specific result string that should be NULL if the operation succeeded.</param>
        void ReportResult(uint hrResult, uint dwError, string szResult);
    }
}
